#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
#include <vector>
#define pii pair <int, int>
using namespace std;
#ifdef ONLINE_JUDGE

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
	int p = 0, flg = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') flg = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		p = p * 10 + c - '0';
		c = getchar();
	}
	return p * flg;
}
void write(int x) {
	if (x < 0) {
		x = -x;
		putchar('-');
	}
	if (x > 9) {
		write(x / 10);
	}
	putchar(x % 10 + '0');
}
const int N = 1e6 + 5, M = 2e6 + 5;
array <int, N> fir;
array <int, M> to, nex;
int cnt;
void add(int x, int y) {
	cnt++;
	nex[cnt] = fir[x];
	to[cnt] = y;
	fir[x] = cnt;
}
array <int, N> fa, dep;
array <int, N> isl;
vector <pii> cur[N];
int dfs(int x) {
	/* write(x), puts(""); */
	isl[x] = x;
	for (int i = fir[x]; i; i = nex[i]) {
		if (to[i] == fa[x]) continue;
		fa[to[i]] = x;
		dep[to[i]] = dep[x] + 1;
		isl[x] = min(isl[x], dfs(to[i]));
	}
	cur[isl[x]].push_back(make_pair(dep[x], x));
	return isl[x];
}
int main() {
	freopen("choice.in", "r", stdin);
	freopen("choice.out", "w", stdout);
	int n = read();
	for (int i = 2; i <= n; i++) {
		int x = read(), y = read();
		add(x, y);
		add(y, x);
		/* write(i), puts(""); */
	}
	dfs(1);
	for (int i = 1; i <= n; i++) {
		if (!cur[i].size()) continue;
		sort(cur[i].begin(), cur[i].end());
		for (auto x : cur[i])
			write(x.second), putchar(32);
	}
	puts("");
	return 0;
}
